﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;

namespace Editor {
	/// <summary>
	/// MainWindow.xaml 的交互逻辑
	/// </summary>
	public partial class MainWindow : Window {
		public MainWindow() {
			if (App.username == null) {
				new WindowLogin().ShowDialog();
			}
			if (App.username != null) {
				InitializeComponent();
				menu1.ItemsSource = new string[] { "项目", "文章" };
			}
			else {
				App.Current.Shutdown();
			}
		}

		private void MenuItem_Click(object sender, RoutedEventArgs e) {
			var _self = e.OriginalSource as MenuItem;
			if (_self.DataContext.ToString() == "项目") {
				frame1.Navigate(new Uri("Page1.xaml", UriKind.Relative));
			}
			MessageBox.Show(_self.DataContext.ToString());
		}

		private void frame1_LoadCompleted(object sender, NavigationEventArgs e) {
			var page = e.Content as Page;
		}

		private void Window_Loaded(object sender, RoutedEventArgs e) {

		}

		private void frame1_Navigating(object sender, NavigatingCancelEventArgs e) {

		}
	}
}
